package cn.edu.zju.gis.disasterBE.sever.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.sql.Timestamp;

@Data
@TableName("news")
@ApiModel("新闻表")
public class News implements Entity<Integer>{
    @TableId(value = "nid", type = IdType.AUTO)
    @ApiModelProperty(value = "新闻id")
    private Integer nid;

    @TableField(value = "title")
    @ApiModelProperty(value = "新闻标题")
    @JSONField(name = "title")
    private String title;

    @TableField(value = "author")
    @ApiModelProperty(value = "新闻作者")
    @JSONField(name = "author")
    private String author;

    @TableField(value = "contents")
    @ApiModelProperty(value = "新闻作者")
    @JSONField(name = "content")
    private String contents;

    @TableField(value = "posttime")
    @ApiModelProperty(value = "发布时间")
    private Timestamp postTime;


    @Override
    public Integer id()
    {
        return nid;
    }
}
